/**
 * 
 */
package leetCode;

/**
 * @author zhongfang
 *
 */
public class onebitandtwobitCharacters {
	public boolean isOneBitCharacter(int[] bits) {
		int n = bits.length;
		if (bits[n - 1] == 1) {
			return false;
		}
		int i = 0;
		boolean tag = false;
		while (i < n) {
			if (bits[i] == 0) {
				tag = true;
				i++;
			} else {
				tag = false;
				i += 2;
			}
		}
		return tag;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int[] bits = { 1, 1, 1, 0 };
		System.out.println(new onebitandtwobitCharacters().isOneBitCharacter(bits));

	}

}
